/*
 * @lc app=leetcode.cn id=1475 lang=typescript
 *
 * [1475] 商品折扣后的最终价格
 */

// @lc code=start
function finalPrices(prices: number[]): number[] {
    return prices.map((el, index) => {
        for (let j = index + 1; j < prices.length; j++) {
            const el1 = prices[j];
            if (el1 <= el) return el - el1;
        }
        return el;
    });
}
// @lc code=end
